<template>
    <div>
      <el-upload
      v-model:file-list="fileList"
      action="http://www.wzsqyg.com/attachment/upload"
      list-type="picture-card"
      :on-success="uploadok"
    >
      <el-icon><Plus /></el-icon>
    </el-upload>
    <el-button @click="confirm">确认提交</el-button>
    </div>
</template>
<script>
// eslint-disable-next-line
import { reactive, watch, ref } from 'vue';
// eslint-disable-next-line
import type { UploadProps, UploadUserFile } from 'element-plus';
import axios from 'axios';
import { useRoute } from 'vue-router';

const route = useRoute();

// eslint-disable-next-line
const fileList = ref<UploadUserFile | any>([]);
watch(fileList, () => {
  console.log('fileList is change', fileList);
});
// eslint-disable-next-line
const uploadok = (response: any) => {
  console.log('res', response);
};

const confirm = async () => {
  const res = await axios.post('http://127.0.0.1:3030/ata', {
    fileList: fileList.value,
    uuid: route.query.uuid,
  });
};

</script>

<script lang="ts">
export default {
  name: 'uploadImg',
};
</script>
